<template>
  <div class="app-container">
    <el-form
      :model="queryParams"
      ref="queryForm"
      size="small"
      :inline="true"
      v-show="showSearch"
      label-width="68px"
    >
      <el-form-item label="" prop="platform">
        <!-- <el-input v-model="queryParams.platform" placeholder="请输入平台名称" clearable @keyup.enter.native="handleQuery" /> -->
        <el-select
          v-model="queryParams.platform"
          placeholder="平台名称"
          clearable
        >
          <el-option
            v-for="dict in dict.type.sys_sample_name"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="" prop="talentLevel">
        <!-- <el-input v-model="queryParams.talentLevel" placeholder="请输入达人层级" clearable @keyup.enter.native="handleQuery" /> -->
        <el-select
          v-model="queryParams.talentLevel"
          placeholder="达人层级"
          clearable
        >
          <el-option
            v-for="dict in dict.type.sys_sample_cj"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="" prop="platformId">
        <el-input
          v-model="queryParams.platformId"
          placeholder="请输入平台ID"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="" prop="xhsNickname" label-width="100px">
        <el-input
          v-model="queryParams.xhsNickname"
          placeholder="请输入昵称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="" prop="contactPerson">
        <el-input
          v-model="queryParams.contactPerson"
          placeholder="请输入对接人"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="" prop="recommendSituation">
        <el-input
          v-model="queryParams.recommendSituation"
          placeholder="请输入种草情况"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="" prop="reason">
        <el-input
          v-model="queryParams.reason"
          placeholder="请输入理由"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="" prop="homeLink">
        <el-input
          v-model="queryParams.homeLink"
          placeholder="请输入主页链接"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>

      <el-form-item label="" prop="fansNumStart">
        <el-input
          style="width: 140px"
          v-model="queryParams.fansNumStart"
          placeholder="最低粉丝量(W)"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="" prop="fansNumEnd">
        <el-input
          style="width: 140px"
          v-model="queryParams.fansNumEnd"
          placeholder="最高粉丝量(W)"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="" prop="likeNumStart">
        <el-input
          style="width: 140px"
          v-model="queryParams.likeNumStart"
          placeholder="最低赞藏量(W)"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="" prop="likeNumEnd">
        <el-input
          style="width: 140px"
          v-model="queryParams.likeNumEnd"
          placeholder="最高赞藏量(W)"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="" prop="cooperatePrice">
        <el-input
          v-model="queryParams.cooperatePrice"
          placeholder="请输入合作报价"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="" prop="contactWechat">
        <el-input
          v-model="queryParams.contactWechat"
          placeholder="请输入联系方式"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="" prop="talentStatus">
        <!-- <el-input v-model="queryParams.platform" placeholder="请输入平台名称" clearable @keyup.enter.native="handleQuery" /> -->
        <el-select
          v-model="queryParams.talentStatus"
          placeholder="状态"
          clearable
        >
          <el-option
            v-for="dict in dict.type.sys_sample_status"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <!-- <el-form-item label="逻辑删除;0=未删除；1=已删除" prop="isDelete">
        <el-input v-model="queryParams.isDelete" placeholder="请输入逻辑删除;0=未删除；1=已删除" clearable
          @keyup.enter.native="handleQuery" />
      </el-form-item> -->
      <el-form-item>
        <el-button
          type="primary"
          icon="el-icon-search"
          size="mini"
          @click="handleQuery"
          >搜索</el-button
        >
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
          >重置</el-button
        >
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['product:sample:add']"
          >新增</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['product:sample:edit']"
          >修改</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['product:sample:remove']"
          >删除</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['product:sample:export']"
          >导出</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button size="mini" plain icon="el-icon-plus" @click="chatAdd"
          >笔记合作</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button size="mini" plain icon="el-icon-plus" @click="chatlive"
          >直播寄样</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button size="mini" plain icon="el-icon-plus" @click="chatVFU"
          >内部寄样</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          size="mini"
          plain
          icon="el-icon-plus"
          @click="chatReturn"
          v-hasPermi="['product:sampleApply:returnApply']"
          >发起退货</el-button
        >
      </el-col>
      <!-- <el-col :span="1.5">
        <el-button size="mini" plain icon="el-icon-plus" @click="chatReturnSelf">自行寄出</el-button>
      </el-col> -->
      <!-- <el-col :span="1.5">
        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAddAll">新增寄样</el-button>
      </el-col> -->
      <right-toolbar
        :showSearch.sync="showSearch"
        @queryTable="getList"
      ></right-toolbar>
    </el-row>

    <div ref="tableDom">
      <el-table
        v-loading="loading"
        :maxHeight="sampleList.length ? tableHeight : 'auto'"
        :data="sampleList"
        @selection-change="handleSelectionChange"
        @row-dblclick="t"
      >
        <el-table-column type="selection" width="50" align="center" />
        <!-- <el-table-column label="达人ID" align="center" prop="id" /> -->
        <el-table-column label="平台名称" align="center" prop="platform" />
        <el-table-column label="达人层级" align="center" prop="talentLevel" />
        <el-table-column
          label="平台ID"
          align="center"
          prop="platformId"
          width="130"
        />
        <el-table-column
          label="昵称"
          align="center"
          prop="xhsNickname"
          width="180"
        />
        <el-table-column
          label="对接人"
          align="center"
          prop="contactPerson"
          width="130"
        />
        <el-table-column
          label="种草情况"
          align="center"
          prop="recommendSituation"
        >
          <template slot-scope="scope">
            <el-popover trigger="hover" placement="top" width="300">
              <!-- <span>{{ scope.row.customerProductTalking }}</span> -->
              <el-input
                v-model="scope.row.recommendSituation"
                :min-height="192"
                type="textarea"
                :autosize="{ minRows: 2, maxRows: 24 }"
                :style="{ width: '100%' }"
                :disabled="true"
              />
              <div slot="reference">
                <span class="textname"
                  >{{ scope.row.recommendSituation }}
                </span>
              </div>
            </el-popover>
          </template>
        </el-table-column>
        <el-table-column label="理由" align="center" prop="reason">
          <template slot-scope="scope">
            <el-popover trigger="hover" placement="top" width="300">
              <!-- <span>{{ scope.row.customerProductTalking }}</span> -->
              <el-input
                v-model="scope.row.reason"
                :min-height="192"
                type="textarea"
                :autosize="{ minRows: 2, maxRows: 24 }"
                :style="{ width: '100%' }"
                :disabled="true"
              />
              <div slot="reference">
                <span class="textname">{{ scope.row.reason }} </span>
              </div>
            </el-popover>
          </template>
        </el-table-column>
        <el-table-column
          label="人设类型/标签"
          align="center"
          prop="personnelType"
          width="110px"
        />
        <el-table-column label="主页链接" align="center" prop="homeLink">
          <template slot-scope="scope">
            <el-popover trigger="hover" placement="top" width="300">
              <!-- <span>{{ scope.row.customerProductTalking }}</span> -->
              <el-input
                v-model="scope.row.homeLink"
                :min-height="192"
                type="textarea"
                :autosize="{ minRows: 2, maxRows: 24 }"
                :style="{ width: '100%' }"
                :disabled="true"
              />
              <div slot="reference">
                <span class="textname">{{ scope.row.homeLink }} </span>
              </div>
            </el-popover>
          </template>
        </el-table-column>
        <el-table-column label="粉丝量(W)" align="center" prop="fansNum" />
        <el-table-column label="赞藏量(W)" align="center" prop="likeNum" />
        <el-table-column label="合作报价" align="center" prop="cooperatePrice">
          <template slot-scope="scope">
            <el-popover trigger="hover" placement="top" width="300">
              <!-- <span>{{ scope.row.customerProductTalking }}</span> -->
              <el-input
                v-model="scope.row.cooperatePrice"
                :min-height="192"
                type="textarea"
                :autosize="{ minRows: 2, maxRows: 24 }"
                :style="{ width: '100%' }"
                :disabled="true"
              />
              <div slot="reference">
                <span class="textname">{{ scope.row.cooperatePrice }} </span>
              </div>
            </el-popover>
          </template>
        </el-table-column>
        <el-table-column
          label="联系方式"
          align="center"
          prop="contactWechat"
          width="130"
        />
        <el-table-column
          label="联系信息"
          align="center"
          prop="contactWechat"
          width="130"
        >
          <template slot-scope="scope">
            <div
              style="
                color: rgb(37, 137, 255);
                cursor: pointer;
                text-decoration: underline;
              "
              @click="contact(scope.row)"
            >
              收件方式
            </div>
            <el-button size="mini" @click="go(scope.row)">
              收件地址配置
            </el-button>
          </template>
        </el-table-column>
        <el-table-column
          label="支付信息"
          align="center"
          prop="contactWechat"
          width="130"
        >
          <template slot-scope="scope">
            <div
              style="
                color: rgb(37, 137, 255);
                cursor: pointer;
                text-decoration: underline;
              "
              @click="pay(scope.row)"
            >
              支付方式
            </div>
            <el-button size="mini" @click="goto(scope.row)">
              支付信息配置
            </el-button>
          </template>
        </el-table-column>
        <el-table-column label="状态" align="center" prop="talentStatus" />
        <el-table-column label="备注" align="center" prop="remark" />
        <el-table-column label="样衣" align="center" prop="">
          <template slot-scope="scope">
            <div
              style="
                color: rgb(37, 137, 255);
                cursor: pointer;
                text-decoration: underline;
              "
              @click="gotoApply(scope.row)"
            >
              样衣信息
            </div>
            <!-- <el-button size="mini" @click="gotoApply(scope.row)">
              样衣记录
            </el-button> -->
          </template>
        </el-table-column>
        <!-- <el-table-column label="逻辑删除;0=未删除；1=已删除" align="center" prop="isDelete" /> -->
        <el-table-column
          label="操作"
          align="center"
          class-name="small-padding fixed-width"
        >
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="text"
              icon="el-icon-edit"
              @click="handleUpdate(scope.row)"
              v-hasPermi="['product:sample:edit']"
              >修改</el-button
            >
            <el-button
              size="mini"
              type="text"
              icon="el-icon-delete"
              @click="handleDelete(scope.row)"
              v-hasPermi="['product:sample:remove']"
              >删除</el-button
            >
          </template>
        </el-table-column>
      </el-table>
    </div>

    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改样衣申请记录对话框 -->
    <el-dialog
      title="新增寄样"
      :visible.sync="openAll"
      width="80%"
      append-to-body
      v-if="openAll"
    >
      <div class="el-dialog-div">
        <el-form ref="form" :model="form" :rules="rules" label-width="100px">
          <el-col :span="7">
            <!-- <el-form-item label="达人信息表ID" prop="sampleTalentInfoId">
              <el-input v-model="form.sampleTalentInfoId" placeholder="达人信息表ID" />
            </el-form-item>
            <el-form-item label="笔记/直播合作ID" prop="sampleTalentCooperateId">
              <el-input v-model="form.sampleTalentCooperateId" placeholder="笔记/直播合作ID" />
            </el-form-item> -->
            <!-- <el-form-item label="模板ID" prop="templateId">
              <el-input v-model="form.templateId" placeholder="模板ID" />
            </el-form-item> -->
            <!-- <el-form-item label="颜色ID" prop="templateSecondryId">
              <el-input v-model="form.templateSecondryId" placeholder="颜色ID" />
            </el-form-item>
            <el-form-item label="尺寸ID" prop="templateSizeId">
              <el-input v-model="form.templateSizeId" placeholder="尺寸ID" />
            </el-form-item>
            <el-form-item label="联系方式ID" prop="contactId">
              <el-input v-model="form.contactId" placeholder="联系方式ID" />
            </el-form-item> -->

            <el-form-item label="合作款式" prop="productNo">
              <!-- <el-input v-model="form.productNo" placeholder="请输入货号" /> -->
              <el-select
                v-model="form.productNo"
                clearable
                filterable
                remote
                :remote-method="getDatas"
                :loading="loading"
                placeholder="请选择合作款式"
              >
                <el-option
                  v-for="item in options"
                  :key="item"
                  :label="item"
                  :value="item"
                >
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="颜色属性" prop="colorProperty">
              <!-- <el-input v-model="form.colorProperty" placeholder="请输入颜色属性" :loading="loading"/> -->
              <el-select
                @focus="onFocus"
                ref="selectRef"
                v-model="form.colorProperty"
                clearable
                filterable
                remote
                :remote-method="getData"
                placeholder="请选择颜色属性"
              >
                <el-option
                  v-for="item in ColorLike"
                  :key="item"
                  :label="item"
                  :value="item"
                >
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="尺寸" prop="size">
              <el-select
                @focus="onFocus"
                v-model="form.size"
                clearable
                filterable
                remote
                :remote-method="getSize"
                placeholder="请选择尺寸"
              >
                <el-option
                  v-for="item in sizeList"
                  :key="item.id"
                  :label="item.size"
                  :value="item.size"
                >
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="商品数量" prop="productNum">
              <el-input v-model="form.productNum" placeholder="商品数量" />
              <span style="color: red">当前库存量：</span>
            </el-form-item>
            <el-form-item label="快递公司" prop="expressCompany">
              <!-- <el-input v-model="form.expressCompany" placeholder="快递公司" /> -->
              <el-select
                v-model="form.expressCompany"
                placeholder="请选择快递公司"
                clearable
                filterable
              >
                <el-option
                  v-for="dict in dict.type.sys_sample_sf"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.label"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="是否归还" prop="isReturn">
              <el-select
                v-model="form.isReturn"
                placeholder="请选择是否归还"
                clearable
                filterable
              >
                <el-option
                  v-for="dict in dict.type.sys_one_zero"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.label"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="所在区域" prop="">
              <el-row>
                <el-select
                  v-model="form.receiverState"
                  placeholder="请选择"
                  @change="selectProvimce"
                  style="width: 100px"
                >
                  <el-option
                    v-for="(item, index) of provincearr"
                    :key="index"
                    :label="item.name"
                    :value="item.name"
                  ></el-option>
                </el-select>
                <el-select
                  v-model="form.receiverCity"
                  placeholder="请选择"
                  @change="selectcity"
                  style="width: 100px"
                >
                  <el-option
                    v-for="(item, index) of cityarr"
                    :key="index"
                    :label="item.name"
                    :value="item.name"
                  ></el-option>
                </el-select>
                <el-select
                  placeholder="请选择"
                  v-model="form.receiverDistrict"
                  style="width: 110px"
                >
                  <el-option
                    v-for="(item, index) of regionarr"
                    :key="index"
                    :label="item.name"
                    :value="item.name"
                  ></el-option>
                </el-select>
              </el-row>
            </el-form-item>
            <el-form-item label="收件人地址" prop="address">
              <el-input
                v-model="form.address"
                placeholder="请输入收件人地址"
                style="width: 300px"
              />
            </el-form-item>
          </el-col>
          <el-col :span="1">
            <el-form-item></el-form-item>
          </el-col>
          <el-col :span="7">
            <el-form-item label="合作方式" prop="talentLevel">
              <el-input
                v-model="form.talentLevel"
                placeholder="请输入合作方式"
              />
            </el-form-item>

            <el-form-item label="平台名称" prop="platform">
              <el-input v-model="form.platform" placeholder="请输入平台名称" />
              <!-- <el-select v-model="form.platform" placeholder="平台名称" clearable>
                <el-option v-for="dict in dict.type.sys_product_qudao" :key="dict.value" :label="dict.label"
                  :value="dict.value" />
              </el-select> -->
            </el-form-item>
            <el-form-item label="达人层级" prop="talentLevel">
              <el-input
                v-model="form.talentLevel"
                placeholder="请输入达人层级"
              />
            </el-form-item>
            <el-form-item label="平台ID" prop="platformId">
              <el-input v-model="form.platformId" placeholder="请输入平台ID" />
            </el-form-item>
            <el-form-item label="昵称" prop="xhsNickname">
              <el-input v-model="form.xhsNickname" placeholder="请输入昵称" />
            </el-form-item>
            <el-form-item label="对接人" prop="contactPerson">
              <el-input
                v-model="form.contactPerson"
                placeholder="请输入对接人"
              />
            </el-form-item>
            <el-form-item label="种草情况" prop="recommendSituation">
              <!-- <el-input v-model="form.recommendSituation" placeholder="请输入种草情况" /> -->
              <el-input
                v-model="form.recommendSituation"
                placeholder="种草情况"
                type="textarea"
                :autosize="{ minRows: 2, maxRows: 12 }"
                :style="{ width: '100%' }"
              />
            </el-form-item>
            <el-form-item label="理由" prop="reason">
              <!-- <el-input v-model="form.reason" placeholder="请输入理由" /> -->
              <el-input
                v-model="form.reason"
                placeholder="理由"
                type="textarea"
                :autosize="{ minRows: 2, maxRows: 12 }"
                :style="{ width: '100%' }"
              />
            </el-form-item>
          </el-col>
          <el-col :span="1">
            <el-form-item></el-form-item>
          </el-col>
          <el-col :span="7">
            <el-form-item label="主页链接" prop="homeLink">
              <!-- <el-input v-model="form.homeLink" placeholder="请输入主页链接" /> -->
              <el-input
                v-model="form.homeLink"
                placeholder="请输入主页链接"
                type="textarea"
                :autosize="{ minRows: 2, maxRows: 12 }"
                :style="{ width: '100%' }"
              />
            </el-form-item>
            <el-form-item label="粉丝量(W)" prop="fansNum">
              <el-input v-model="form.fansNum" placeholder="请输入粉丝量" />
            </el-form-item>
            <el-form-item label="赞藏量(W)" prop="likeNum">
              <el-input v-model="form.likeNum" placeholder="请输入赞藏量" />
            </el-form-item>
            <el-form-item label="合作报价" prop="cooperatePrice">
              <!-- <el-input v-model="form.cooperatePrice" placeholder="请输入合作报价" /> -->
              <el-input
                v-model="form.cooperatePrice"
                placeholder="请输入合作报价"
                type="textarea"
                :autosize="{ minRows: 2, maxRows: 12 }"
                :style="{ width: '100%' }"
              />
            </el-form-item>
            <el-form-item label="联系方式" prop="contactWechat">
              <el-input
                v-model="form.contactWechat"
                placeholder="请输入联系方式"
              />
            </el-form-item>

            <el-form-item label="状态" prop="talentStatus">
              <!-- <el-input v-model="queryParams.platform" placeholder="请输入平台名称" clearable @keyup.enter.native="handleQuery" /> -->
              <el-select
                v-model="form.talentStatus"
                placeholder="状态"
                clearable
              >
                <el-option
                  v-for="dict in dict.type.sys_sample_status"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="备注" prop="remark">
              <el-input v-model="form.remark" placeholder="备注" />
            </el-form-item>
          </el-col>
        </el-form>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFormAll">确 定</el-button>
        <el-button @click="cancelAll">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 添加或修改达人信息对话框 -->
    <el-dialog
      :title="title"
      :visible.sync="open"
      width="60%"
      height="80%"
      append-to-body
    >
      <div class="el-dialog-div">
        <el-form
          ref="form"
          :model="form"
          :rules="rules"
          label-width="80px"
          :inline="true"
        >
          <el-col :span="8">
            <el-form-item label="平台名称" prop="platform">
              <!-- <el-input v-model="form.platform" placeholder="请输入平台名称" /> -->
              <el-select
                v-model="form.platform"
                placeholder="平台名称"
                clearable
              >
                <el-option
                  v-for="dict in dict.type.sys_sample_name"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="达人层级" prop="talentLevel">
              <!-- <el-input v-model="form.talentLevel" placeholder="请输入达人层级" /> -->
              <el-select
                v-model="form.talentLevel"
                placeholder="达人层级"
                clearable
              >
                <el-option
                  v-for="dict in dict.type.sys_sample_cj"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="平台ID" prop="platformId">
              <el-input v-model="form.platformId" placeholder="请输入平台ID" />
            </el-form-item>
            <el-form-item label="昵称" prop="xhsNickname">
              <el-input v-model="form.xhsNickname" placeholder="请输入昵称" />
            </el-form-item>
            <el-form-item label="人设类型/标签" prop="personnelType">
              <el-input
                v-model="form.personnelType"
                placeholder="请输入人设类型/标签"
              />
            </el-form-item>
            <el-form-item label="对接人" prop="contactPerson">
              <el-input
                v-model="form.contactPerson"
                placeholder="请输入对接人"
              />
            </el-form-item>
            <el-form-item label="种草情况" prop="recommendSituation">
              <!-- <el-input v-model="form.recommendSituation" placeholder="请输入种草情况" /> -->
              <el-input
                v-model="form.recommendSituation"
                placeholder="种草情况"
                type="textarea"
                :autosize="{ minRows: 2, maxRows: 12 }"
                :style="{ width: '100%' }"
              />
            </el-form-item>
            <el-form-item label="理由" prop="reason">
              <!-- <el-input v-model="form.reason" placeholder="请输入理由" /> -->
              <el-input
                v-model="form.reason"
                placeholder="理由"
                type="textarea"
                :autosize="{ minRows: 2, maxRows: 12 }"
                :style="{ width: '100%' }"
              />
            </el-form-item>
          </el-col>
          <el-col :span="1">
            <el-form-item></el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="主页链接" prop="homeLink">
              <!-- <el-input v-model="form.homeLink" placeholder="请输入主页链接" /> -->
              <el-input
                v-model="form.homeLink"
                placeholder="请输入主页链接"
                type="textarea"
                :autosize="{ minRows: 2, maxRows: 12 }"
                :style="{ width: '100%' }"
              />
            </el-form-item>
            <el-form-item label="粉丝量(W)" prop="fansNum">
              <el-input v-model="form.fansNum" placeholder="请输入粉丝量" />
            </el-form-item>
            <el-form-item label="赞藏量(W)" prop="likeNum">
              <el-input v-model="form.likeNum" placeholder="请输入赞藏量" />
            </el-form-item>
            <el-form-item label="合作报价" prop="cooperatePrice">
              <!-- <el-input v-model="form.cooperatePrice" placeholder="请输入合作报价" /> -->
              <el-input
                v-model="form.cooperatePrice"
                placeholder="请输入合作报价"
                type="textarea"
                :autosize="{ minRows: 2, maxRows: 12 }"
                :style="{ width: '100%' }"
              />
            </el-form-item>
            <el-form-item label="联系方式" prop="contactWechat">
              <el-input
                v-model="form.contactWechat"
                placeholder="请输入联系方式"
              />
            </el-form-item>

            <el-form-item label="状态" prop="talentStatus">
              <!-- <el-input v-model="queryParams.platform" placeholder="请输入平台名称" clearable @keyup.enter.native="handleQuery" /> -->
              <el-select
                v-model="form.talentStatus"
                placeholder="状态"
                clearable
              >
                <el-option
                  v-for="dict in dict.type.sys_sample_status"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="备注" prop="remark">
              <el-input v-model="form.remark" placeholder="备注" />
            </el-form-item>
            <!-- <el-form-item label="逻辑删除;0=未删除；1=已删除" prop="isDelete">
          <el-input v-model="form.isDelete" placeholder="请输入逻辑删除;0=未删除；1=已删除" />
        </el-form-item> -->
          </el-col>
          <el-col :span="1">
            <el-form-item></el-form-item>
          </el-col>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button type="primary" @click="submitForm">确 定</el-button>
          <el-button @click="cancel">取 消</el-button>
        </div>
      </div>
    </el-dialog>
    <!-- 笔记合作方式 -->
    <el-dialog
      :visible.sync="Visiblenote"
      append-to-body
      title="笔记合作"
      width="500px"
      v-if="Visiblenote"
    >
      <el-form
        ref="fAdd"
        :model="fAdd"
        :rules="rules"
        label-width="100px"
        :inline="true"
      >
        <el-row v-for="(noticItem, index) in colorProperty" :key="index">
          <el-col>
            <el-form-item label="合作款式" prop="colorProperty">
              <!-- <el-input v-model="noticItem.value" placeholder="请输入颜色属性" /> -->
              <el-select
                v-model="noticItem.value"
                clearable
                filterable
                remote
                :remote-method="getData"
                :loading="loading"
                placeholder="合作款式"
              >
                <el-option
                  v-for="item in productNooptions"
                  :key="item"
                  :label="item"
                  :value="item"
                >
                </el-option>
              </el-select>
            </el-form-item>
            <el-button size="mini" @click.prevent="removeDomain(noticItem)"
              >删除</el-button
            >
          </el-col>
          <!-- <el-col :span="1"> -->

          <!-- </el-col> -->
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer" style="margin-top: 50px">
        <el-button type="primary" @click="submitNote">确 定</el-button>
        <!-- <el-button @click="canNew">取 消</el-button> -->
        <el-button @click="addDomain">新增</el-button>
      </div>
    </el-dialog>

    <!-- 直播合作方式 -->
    <el-dialog
      :visible.sync="VisibleLive"
      append-to-body
      title="直播合作"
      width="500px"
      v-if="VisibleLive"
    >
      <el-form
        ref="fLive"
        :model="fLive"
        :rules="rules"
        label-width="110px"
        :inline="true"
      >
        <el-form-item label="请选择收件地址" prop="address">
          <el-select v-model="fLive.id">
            <el-option
              v-for="item in optionsContact"
              :key="item.id"
              :label="`${item.recipient},${item.phone},${item.receiverState}${item.receiverCity}${item.receiverDistrict}${item.address}`"
              :value="item.id"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="是否归还" prop="isReturn">
          <!-- <el-input v-model="formVFU.isReturn" placeholder="是否归还" /> -->
          <el-select
            v-model="fLive.isReturn"
            placeholder="请选择是否归还"
            clearable
            filterable
          >
            <el-option
              v-for="dict in dict.type.sys_one_zero"
              :key="dict.value"
              :label="dict.label"
              :value="dict.label"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="快递公司" prop="expressCompany">
          <!-- <el-input v-model="formVFU.expressCompany" placeholder="快递公司" /> -->
          <el-select
            v-model="fLive.expressCompany"
            placeholder="请选择快递公司"
            clearable
            filterable
          >
            <el-option
              v-for="dict in dict.type.sys_sample_sf"
              :key="dict.value"
              :label="dict.label"
              :value="dict.label"
            />
          </el-select>
        </el-form-item>
        <!-- <template> -->
        <el-row>
          <el-col>
            <el-form-item
              label="合作款式"
              prop="colorProperty"
              v-for="noticItem in colorProperty"
              :key="noticItem.key"
            >
              <el-select
                v-model="noticItem.value"
                clearable
                filterable
                remote
                :remote-method="getData"
                :loading="loading"
                placeholder="合作款式"
              >
                <el-option
                  v-for="item in productNooptions"
                  :key="item"
                  :label="item"
                  :value="item"
                >
                </el-option>
              </el-select>
            </el-form-item>
            <el-button size="mini" @click.prevent="removeLive(noticItem)"
              >删除</el-button
            >
          </el-col>
        </el-row>
        <!-- </template> -->
      </el-form>
      <div slot="footer" class="dialog-footer" style="margin-top: 50px">
        <el-button type="primary" @click="submitLive('fLive')">确 定</el-button>
        <!-- <el-button @click="canNew">取 消</el-button> -->
        <el-button @click="addLive">新增</el-button>
      </div>
    </el-dialog>

    <!-- 内部寄样 -->
    <el-dialog
      :visible.sync="VisibleVFU"
      append-to-body
      title="内部寄样"
      width="500px"
      v-if="VisibleVFU"
    >
      <el-form
        ref="formVFU"
        :model="formVFU"
        :rules="rules"
        label-width="110px"
        :inline="true"
      >
        <el-form-item label="请选择收件地址" prop="address">
          <el-select v-model="formVFU.id">
            <el-option
              v-for="item in optionsContact"
              :key="item.id"
              :label="`${item.recipient},${item.phone},${item.receiverState}${item.receiverCity}${item.receiverDistrict}${item.address}`"
              :value="item.id"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="是否归还" prop="isReturn">
          <!-- <el-input v-model="formVFU.isReturn" placeholder="是否归还" /> -->
          <el-select
            v-model="formVFU.isReturn"
            placeholder="请选择是否归还"
            clearable
            filterable
          >
            <el-option
              v-for="dict in dict.type.sys_one_zero"
              :key="dict.value"
              :label="dict.label"
              :value="dict.label"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="快递公司" prop="expressCompany">
          <!-- <el-input v-model="formVFU.expressCompany" placeholder="快递公司" /> -->
          <el-select
            v-model="formVFU.expressCompany"
            placeholder="请选择快递公司"
            clearable
            filterable
          >
            <el-option
              v-for="dict in dict.type.sys_sample_sf"
              :key="dict.value"
              :label="dict.label"
              :value="dict.label"
            />
          </el-select>
        </el-form-item>
        <el-row v-for="(noticItem, index) in colorProperty" :key="index">
          <el-col>
            <el-form-item label="合作款式" prop="colorProperty">
              <!-- <el-input v-model="noticItem.value" placeholder="请输入颜色属性" /> -->
              <el-select
                v-model="noticItem.value"
                clearable
                filterable
                remote
                :remote-method="getData"
                :loading="loading"
                placeholder="合作款式"
              >
                <el-option
                  v-for="item in productNooptions"
                  :key="item"
                  :label="item"
                  :value="item"
                >
                </el-option>
              </el-select>
            </el-form-item>
            <el-button size="mini" @click.prevent="removeVFU(noticItem)"
              >删除</el-button
            >
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer" style="margin-top: 50px">
        <el-button type="primary" @click="submitVFU">确 定</el-button>
        <!-- <el-button @click="canNew">取 消</el-button> -->
        <el-button @click="addVFU">新增</el-button>
      </div>
    </el-dialog>

    <!-- 自行寄出 -->
    <el-dialog
      :visible.sync="VisibleSelf"
      append-to-body
      title="自行寄出"
      width="500px"
      v-if="VisibleSelf"
    >
      <el-form
        ref="formVFU"
        :model="formSelf"
        :rules="rules"
        label-width="110px"
        :inline="true"
      >
        <el-form-item label="退货快递单号" prop="address">
          <!-- <el-select v-model="formSelf.id">
      <el-option v-for="item in optionsContact" :key="item.id" :label="item.address" :value="item.id" />
    </el-select> -->
          <el-input
            v-model="formSelf.expressNumber"
            placeholder="请输入退货快递单号"
          />
        </el-form-item>
        <!-- <el-form-item label="是否归还" prop="isReturn">
   
    <el-select v-model="formVFU.isReturn" placeholder="请选择是否归还" clearable filterable>
      <el-option v-for="dict in dict.type.sys_one_zero" :key="dict.value" :label="dict.label" :value="dict.label" />
    </el-select>
  </el-form-item> -->
        <el-form-item label="快递公司" prop="expressCompany">
          <!-- <el-input v-model="formVFU.expressCompany" placeholder="快递公司" /> -->
          <el-select
            v-model="formSelf.expressCompany"
            placeholder="请选择快递公司"
            clearable
            filterable
          >
            <el-option
              v-for="dict in dict.type.sys_sample_sf"
              :key="dict.value"
              :label="dict.label"
              :value="dict.label"
            />
          </el-select>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer" style="margin-top: 50px">
        <el-button type="primary" @click="submitSelf">确 定</el-button>
        <!-- <el-button @click="canNew">取 消</el-button> -->
        <el-button @click="cancelSelf">取 消</el-button>
      </div>
    </el-dialog>

    <el-dialog
      :visible.sync="Visiblereturn"
      append-to-body
      title="发起退货"
      width="500px"
      v-if="Visiblereturn"
    >
      <el-form
        ref="fReturn"
        :model="fReturn"
        :rules="rules"
        label-width="110px"
        :inline="true"
      >
        <el-form-item label="寄出方式" prop="returnAddress">
          <el-radio-group
            v-model="state"
            size="small"
            fill="#66b1ff"
            @change="changeState"
          >
            <el-radio :label="0">上门取件</el-radio>
            <el-radio :label="1">自行寄出</el-radio>
          </el-radio-group>
        </el-form-item>

        <el-form-item label="取件地址" prop="returnAddress" v-show="noSelf">
          <!-- <el-input v-model="fReturn.returnAddress" placeholder="客户收件人地址" /> -->
          <el-select v-model="fReturn.returnContactId">
            <el-option
              v-for="item in optionsContact"
              :key="item.id"
              :label="`${item.phone},${item.recipient},${item.receiverState}${item.receiverCity}${item.receiverDistrict}${item.address}`"
              :value="item.id"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="仓库地址" prop="returnAddress" v-show="noSelf">
          <!-- <el-input v-model="fReturn.returnAddress" placeholder="客户收件人地址" /> -->
          <el-select
            @focus="onFocus"
            v-model="fReturn.sampleReturnAddressId"
            clearable
            filterable
            remote
            :remote-method="changeAddress"
          >
            <el-option
              v-for="item in returnAddressList"
              :key="item.id"
              :label="`${item.returnName},${item.returnPhone},${item.returnAddress}`"
              :value="item.id"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="预约日期" prop="pickupDayType" v-show="noSelf">
          <!-- <el-date-picker clearable v-model="fReturn.returnDate" type="date" value-format="yyyy-MM-dd"
            placeholder="请选择预约时间">
          </el-date-picker> -->
          <el-select
            v-model="fReturn.pickupDayType"
            placeholder="请选择预约时间"
            clearable
          >
            <el-option
              v-for="dict in dict.type.sys_sample_day"
              :key="dict.value"
              :label="dict.label"
              :value="dict.label"
            />
          </el-select>
        </el-form-item>

        <el-form-item label="上门时间" prop="returnDate" v-show="noSelf">
          <!-- <el-date-picker clearable v-model="fReturn.returnDate" type="date" value-format="yyyy-MM-dd"
            placeholder="请选择上门时间">
          </el-date-picker> -->
          <el-select
            v-model="returnDate"
            placeholder="请选择上门时间"
            clearable
          >
            <el-option
              v-for="dict in dict.type.sys_sample_time"
              :key="dict.value"
              :label="dict.label"
              :value="dict.label"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="快递公司" prop="expressCompany">
          <!-- <el-input v-model="Contact.expressCompany" placeholder="快递公司" /> -->
          <el-select
            v-model="fReturn.expressCompany"
            placeholder="请选择快递公司"
            clearable
            filterable
          >
            <el-option
              v-for="dict in dict.type.sys_sample_sf"
              :key="dict.value"
              :label="dict.label"
              :value="dict.label"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="退货快递单号" prop="address" v-show="!noSelf">
          <!-- <el-select v-model="formSelf.id">
      <el-option v-for="item in optionsContact" :key="item.id" :label="item.address" :value="item.id" />
    </el-select> -->
          <el-input
            v-model="fReturn.expressNumber"
            placeholder="请输入退货快递单号"
          />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer" style="margin-top: 50px">
        <el-button type="primary" @click="submitReturn" v-show="noSelf"
          >确 定</el-button
        >
        <el-button type="primary" @click="submitSelf" v-show="!noSelf"
          >确 定</el-button
        >
        <!-- <el-button @click="canNew">取 消</el-button> -->
        <el-button @click="Return">取消</el-button>
      </div>
    </el-dialog>

    <!-- 添加或修改产品二级信息对话框 :on-change="handleChange"-->
    <el-dialog title="支付信息" :visible.sync="payopen" append-to-body>
      <el-table :data="payList">
        <!-- <el-table-column type="selection" width="55" align="center" /> -->
        <!-- <el-table-column label="支付ID" align="center" prop="id" />
      <el-table-column label="达人信息表ID" align="center" prop="sampleTalentInfoId" /> -->
        <el-table-column label="支付方式" align="center" prop="payMethod" />
        <el-table-column label="支付账号" align="center" prop="payAccount" />
        <el-table-column
          label="收款码"
          align="center"
          prop="payImage"
          width="100"
        >
          <template #default="scope">
            <el-popover
              effect="light"
              trigger="click"
              placement="bottom"
              width="auto"
              v-if="scope.row.payImage"
            >
              <template #default>
                <img
                  :src="pjtUrl + scope.row.payImage"
                  style="width: 800px; height: 600px; object-fit: contain"
                  lazy
                />
              </template>
              <template #reference>
                <img
                  :src="pjtUrl + scope.row.payImage"
                  style="object-fit: contain; width: 80px; height: 80px"
                  lazy
                />
              </template>
            </el-popover>
          </template>
        </el-table-column>
        <el-table-column label="姓名" align="center" prop="payName" />
        <el-table-column label="备注" align="center" prop="remark" />
      </el-table>
    </el-dialog>
    <!-- 添加或修改产品二级信息对话框 :on-change="handleChange"-->
    <el-dialog title="联系方式" :visible.sync="contactopen" append-to-body>
      <el-table :data="contactList">
        <!-- <el-table-column type="selection" width="55" align="center" /> -->
        <!-- <el-table-column label="联系ID" align="center" prop="id" />
      <el-table-column label="达人信息表ID" align="center" prop="sampleTalentInfoId" /> -->
        <el-table-column label="收件人" align="center" prop="recipient" />
        <el-table-column label="电话" align="center" prop="phone" />

        <el-table-column label="收货省份" align="center" prop="receiverState" />
        <el-table-column label="收货市" align="center" prop="receiverCity" />
        <el-table-column
          label="收货区"
          align="center"
          prop="receiverDistrict"
        />
        <!-- <el-table-column label="收件人地址" align="center" prop="address" /> -->
        <el-table-column label="收件人地址" align="center" prop="address" />
        <!-- :formatter="formatData" -->
        <el-table-column label="备注" align="center" prop="remark" />
      </el-table>
    </el-dialog>

    <!-- 添加或修改产品二级信息对话框 :on-change="handleChange"-->
    <el-dialog
      title="联系方式"
      :visible.sync="openApply"
      append-to-body
      width="80%"
    >
      <el-table :data="sampleApplyList">
        <!-- <el-table-column type="selection" width="55" align="center" /> -->
        <!-- <el-table-column label="联系ID" align="center" prop="id" />
      <el-table-column label="达人信息表ID" align="center" prop="sampleTalentInfoId" /> -->
        <!-- <el-table-column label="电话" align="center" prop="phone" />
        <el-table-column label="收件人" align="center" prop="recipient" />
        <el-table-column label="收件人地址" align="center" prop="address" />
        <el-table-column label="备注" align="center" prop="remark" /> -->
        <el-table-column
          label="合作款式"
          align="center"
          prop="productNo"
          width="110"
        />
        <el-table-column
          label="款式主图"
          align="center"
          prop="styleMainImage"
          width="100"
        >
          <template slot-scope="scope">
            <image-preview
              :src="scope.row.styleMainImage"
              :width="50"
              :height="50"
            />
          </template>
        </el-table-column>
        <el-table-column
          label="商品编码"
          align="center"
          prop="productCode"
          width="150"
        />
        <el-table-column label="商品数量" align="center" prop="productNum" />
        <el-table-column label="颜色属性" align="center" prop="colorProperty" />
        <el-table-column label="尺寸" align="center" prop="size" />
        <el-table-column
          label="申请人"
          align="center"
          prop="buyerAccount"
          width="150"
        />
        <el-table-column
          label="申请时间"
          align="center"
          prop="createTime"
          width="150"
        />
        <el-table-column label="手机" align="center" prop="phone" width="110" />
        <el-table-column label="收件人" align="center" prop="recipient" />
        <el-table-column
          label="收件人地址"
          align="center"
          prop="address"
          width="100"
        >
          <template slot-scope="scope">
            <el-popover trigger="hover" placement="top" width="300">
              <!-- <span>{{ scope.row.customerProductTalking }}</span> -->
              <el-input
                v-model="scope.row.address"
                :min-height="192"
                type="textarea"
                :autosize="{ minRows: 2, maxRows: 24 }"
                :style="{ width: '100%' }"
                :disabled="true"
              />
              <div slot="reference">
                <span class="textname">{{ scope.row.address }} </span>
              </div>
            </el-popover>
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>
  </div>
</template>

<script>
import {
  listReturnAddress,
  getReturnAddress,
  delReturnAddress,
  addReturnAddress,
  updateReturnAddress,
  search,
} from "@/api/sample/returnAddress";
import { province } from "@/api/sample/map";
import {
  listSecondry,
  getSecondry,
  delSecondry,
  addSecondry,
  updateSecondry,
  getInfoByName,
  productNoColorLike,
  listAll,
} from "@/api/product/secondry";
import {
  listSampleApply,
  getSampleApply,
  delSampleApply,
  addSampleApply,
  updateSampleApply,
  addApply,
  returnApply,
} from "@/api/sample/sampleApply";
import {
  listContact,
  getContact,
  delContact,
  addContact,
  updateContact,
} from "@/api/sample/contact";
import { listPay, getPay, delPay, addPay, updatePay } from "@/api/sample/pay";
import { batchAdd } from "@/api/sample/live";
import {
  listNote,
  getNote,
  delNote,
  addNote,
  updateNote,
} from "@/api/sample/note";
import {
  listTemplate,
  getTemplate,
  delTemplate,
  addTemplate,
  updateTemplate,
  addTemplateAndSecondry,
  addProNoColorSize,
  productNoLike,
} from "@/api/product/template";
import {
  listSample,
  getSample,
  delSample,
  addSample,
  updateSample,
  SampleTalentFirstAdd,
} from "@/api/sample/sample";

export default {
  name: "Sample",
  dicts: [
    "sys_product_qudao",
    "sys_sample_status",
    "sys_sample_sf",
    "sys_one_zero",
    "sys_sample_day",
    "sys_sample_time",
    "sys_sample_name",
    "sys_sample_cj",
  ],
  data() {
    return {
      pjtUrl: process.env.VUE_APP_BASE_API,
      //上门时间
      returnDate: "15:00-17:00",
      //上门取件or自行寄出
      state: 0,
      noSelf: true,

      VisibleSelf: false,
      formSelf: {},

      //模糊匹配
      sizeList: [],
      ColorLike: [],
      options: [], // 选项，从后端传递过来

      openAll: false,
      //省市区
      arr: [1, 3, 4],
      province: [],
      cityarr: [],
      regionarr: [],

      tableHeight: "",
      //达人收件信息
      optionsContact: [],
      formVFU: {
        isReturn: "是",

        expressCompany: "中通快递",
      },
      VisibleVFU: false,
      fVFU: {
        colorProperty: [{ value: "" }],
      },
      //上门取件
      Visiblereturn: false,
      fReturn: {
        pickupDayType: "今天",
        expressCompany: "中通快递",
      },
      returnAddressList: [],

      openApply: false,
      sampleApplyList: [],

      contactopen: false,
      contactList: [],
      //  达人信息-支付信息表格数据
      payList: [],
      payopen: false,
      productNooptions: [],
      // 表单参数
      fAdd: {
        colorProperty: [{ value: "" }],
      },
      //笔记合作方式

      Visiblenote: false,
      // 表单参数
      fLive: {
        isReturn: "是",

        expressCompany: "中通快递",
      },
      colorProperty: [{ value: "", key: "1" }],
      //笔记合作方式

      VisibleLive: false,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 达人信息表格数据
      sampleList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        platform: null,
        talentLevel: null,
        platformId: null,
        xhsNickname: null,
        contactPerson: null,
        recommendSituation: null,
        reason: null,
        personnelType: null,
        homeLink: null,
        fansNum: null,
        likeNum: null,
        cooperatePrice: null,
        contactWechat: null,
        talentStatus: null,
        isDelete: null,
        fansNumStart: null,
        fansNumEnd: null,
        likeNumStart: null,
        likeNumEnd: null,
      },
      // 表单参数
      form: {
        // isReturn: '是'
      },
      // 表单校验
      rules: {
        platform: [
          { required: true, message: "平台名称不能为空", trigger: "blur" },
        ],
        platformId: [
          { required: true, message: "平台ID不能为空", trigger: "blur" },
        ],
      },
    };
  },
  created() {
    // this.$set(this.fLive, "colorProperty", null);
    this.provincearr = province;
    // this.getList();
    if (this.$route.query.platformId) {
      this.$set(this.queryParams, "platformId", this.$route.query.platformId);
    }
    this.getList();
  },
  mounted() {
    var _this = this;
    this.resizeTable();
    window.onresize = function () {
      _this.resizeTable();
    };
  },
  //记得清空  如果在keepalive中 则使用activated  deactivated
  destroyed() {
    // Object.assign(this.$data, this.$options.data());
    window.onresize = null;
  },
  methods: {
    submitFormAll() {},
    cancelAll() {
      this.openAll = false;
    },

    handleAddAll() {
      this.openAll = true;
    },

    //修改对话框
    //添加颜色列表获得焦点
    onFocus() {
      this.getData();

      this.getSize();
      this.changeAddress("");
      // if (!this.form.colorProperty) {
      //     this.$selectRef.value.blur() //就是这一句，
      // }
    },

    //修改对话框
    /* 获取颜色列表 */
    getSize(key) {
      console.log(JSON.stringify(key));
      // this.loading = true;
      // return
      listAll({
        productNo: this.form.productNo,
        colorProperty: this.form.colorProperty,
      }).then((res) => {
        // this.loading = false;
        this.sizeList = res;
        console.log(JSON.stringify(res));
      });
    },
    /* 获取颜色列表 */
    getData(key) {
      console.log(JSON.stringify(key));
      // this.loading = true;
      // return
      productNoColorLike({ productNo: this.form.productNo, color: key }).then(
        (res) => {
          // this.loading = false;
          this.ColorLike = res.data;
          console.log(JSON.stringify(this.ColorLike));
        }
      );
    },

    /* 获取货号列表 */
    getDatas(key) {
      console.log(JSON.stringify(key));
      this.loading = true;
      // return
      productNoLike(key).then((res) => {
        this.loading = false;
        this.options = res.data;
        console.log(JSON.stringify(this.options));
      });
    },
    //自行寄出
    chatReturnSelf() {
      if (this.ids.length > 1 || this.ids.length == 0) {
        this.$modal.msgError("请选择一个指定达人信息！");
        return;
      }

      this.VisibleSelf = true;
    },
    cancelSelf() {
      this.VisibleSelf = false;
    },
    submitSelf() {
      if (!this.fReturn.expressNumber) {
        this.$modal.msgError("请输入退货快递单号");
        return;
      }
      var formreturn = {
        returnMethod: "selfsending",
        sampleTalentInfoId: this.ids[0],
        ...this.fReturn,
      };
      console.log(JSON.stringify(formreturn));
      // return
      returnApply(formreturn).then((response) => {
        if (response.code == 200) {
          if (response.msg == "操作完成！") {
            this.$modal.msgSuccess("申请成功");
            this.$router.push({
              path: "/sample/sampleReturn",
              query: { sampleTalentInfoId: this.ids[0] },
            });
          } else {
            this.$modal.msgError(response.msg);
          }
        } else {
          this.$modal.msgError(response.msg);
        }
      });
    },
    changeAddress(val) {
      console.log(val);
      search(val).then((response) => {
        console.log(JSON.stringify(response));
        this.returnAddressList = response;
      });
    },
    changeState(val) {
      console.log(val);
      if (val == 0) {
        console.log(0);
        this.fReturn = {};
        // this.fReturn.expressCompany = '中通快递'
        this.noSelf = true;
      } else {
        console.log(1);
        this.fReturn = {};
        // this.fReturn.expressCompany = '中通快递'
        this.noSelf = false;
      }
    },

    //申请退货
    chatReturn(row) {
      if (this.ids.length > 1 || this.ids.length == 0) {
        this.$modal.msgError("请选择一个指定达人信息！");
        return;
      }

      listContact({ sampleTalentInfoId: this.ids[0] }).then((res) => {
        if (res.rows.length == 0) {
          this.$modal.msgError("请添加达人收件信息！");
          return;
        } else if (res.rows.length > 0) {
          this.optionsContact = res.rows;
          console.log(JSON.stringify(this.optionsContact));
          this.Visiblereturn = true;
        }
      });
    },
    Return() {
      this.Visiblereturn = false;
    },
    submitReturn() {
      if (!this.fReturn.returnContactId) {
        this.$modal.msgError("请选择取件地址");
        return;
      }
      if (!this.fReturn.sampleReturnAddressId) {
        this.$modal.msgError("请选择仓库地址");
        return;
      }
      var pickupStartTime = this.returnDate.split("-")[0];
      var pickupEndTime = this.returnDate.split("-")[1];
      console.log(JSON.stringify(pickupStartTime));
      console.log(JSON.stringify(pickupEndTime));
      var formreturn = {
        returnMethod: "pickup",
        sampleTalentInfoId: this.ids[0],
        ...this.fReturn,
        pickupStartTime: pickupStartTime,
        pickupEndTime: pickupEndTime,
      };
      console.log(JSON.stringify(formreturn));
      // return
      returnApply(formreturn).then((response) => {
        if (response.code == 200) {
          if (response.msg == "操作完成！") {
            this.$modal.msgSuccess("申请成功");
            this.$router.push({
              path: "/sample/sampleReturn",
              query: { sampleTalentInfoId: this.ids[0] },
            });
          } else {
            this.$modal.msgError(response.msg);
          }
        } else {
          this.$modal.msgError(response.msg);
        }
      });
    },
    //点击某一行
    t(row, column, cell, event) {
      console.log(row, column, cell, event);
      this.handleUpdate(row);
    },

    /* 获取货号列表 */
    getData(key) {
      console.log(JSON.stringify(key));
      this.loading = true;
      // return
      productNoLike(key).then((res) => {
        this.loading = false;
        this.productNooptions = res.data;
        // console.log(JSON.stringify(this.options));
      });
    },

    // 删除
    removeVFU(item) {
      var index = this.colorProperty.indexOf(item);
      if (index == "0") {
        // 还有一个的时候提示不能删除
        this.$message({
          message: "不能删除了",
          type: "error",
        });
        return false;
      }
      if (index !== -1 && index !== "0") {
        this.colorProperty.splice(index, 1);
      }
    },
    // 表单新增
    addVFU() {
      this.colorProperty.push({
        value: "",
        // key: Date.now()+,
      });
    },
    //el-dialog关闭
    // handleClose() {
    //   // Object.assign(this.$data, this.$options.data())
    //   this.$data = this.$options.data();
    //   this.
    //   this.VisibleVFU = false;
    // },
    //批量添加
    chatVFU(row) {
      if (this.ids.length > 1 || this.ids.length == 0) {
        this.$modal.msgError("请选择一个指定达人信息！");
        return;
      }
      listContact({ sampleTalentInfoId: this.ids[0] }).then((res) => {
        if (res.rows.length == 0) {
          this.$modal.msgError("请添加达人收件信息！");
          return;
        } else if (res.rows.length > 0) {
          this.optionsContact = res.rows;
          console.log(JSON.stringify(this.optionsContact));
          this.VisibleVFU = true;
        }
      });
    },
    //批量添加
    submitVFU() {
      if (!this.formVFU.id) {
        this.$modal.msgError("请选择一个收件地址！");
        return;
      }
      // this.fLive.sampleTalentInfoId = this.ids[0]
      let label = [];
      this.colorProperty.forEach((item) => {
        //判断条件 货号不能为空
        if (label.indexOf(item.value) == -1 && item.value !== "") {
          label.push({
            productNo: item.value,
            sampleTalentInfoId: this.ids[0],
            sampleTalentCooperateId: null,
            sampleTalentCooperateType: "VFU",
            contactId: this.formVFU.id,
            ...this.formVFU,
          });
        }
      });
      if (label.length == 0) {
        this.$modal.msgError("请选择至少一个合作款式！");
        return;
      }
      this.formVFU = label;
      // console.log(JSON.stringify(this.fLive.sampleTalentTemplateList));
      console.log(JSON.stringify(this.formVFU));
      // return
      this.$refs["formVFU"].validate((valid) => {
        if (valid) {
          addApply(this.formVFU).then((response) => {
            if (response.code == 200) {
              this.$modal.msgSuccess("申请成功");

              // this.getList();
              // this.fAdd.colorProperty = []
              this.VisibleVFU = false;
              this.$router.push({
                path: "/sample/sampleApply",
                query: { id: this.ids[0] },
              });
              // Object.assign(this.$data, this.$options.data());
            } else {
              this.$modal.msgError("新增失败！");
              Object.assign(this.$data, this.$options.data());
              this.VisibleVFU = false;
              this.getList();
            }
          });
        }
      });
    },

    // 删除
    removeLive(item) {
      var index = this.colorProperty.indexOf(item);
      if (index == "0") {
        // 还有一个的时候提示不能删除
        this.$message({
          message: "不能删除了",
          type: "error",
        });
        return false;
      }
      if (index !== -1 && index !== "0") {
        this.colorProperty.splice(index, 1);
      }
    },
    // 表单新增
    addLive() {
      this.colorProperty.push({
        value: "",
        key: Date.now(),
      });
    },
    //批量添加
    chatlive(row) {
      if (this.ids.length > 1 || this.ids.length == 0) {
        this.$modal.msgError("请选择一个指定达人信息！");
        return;
      }
      listContact({ sampleTalentInfoId: this.ids[0] }).then((res) => {
        if (res.rows.length == 0) {
          this.$modal.msgError("请添加达人收件信息！");
          return;
        } else if (res.rows.length > 0) {
          this.optionsContact = res.rows;
          console.log(JSON.stringify(this.optionsContact));
          this.VisibleLive = true;
        }
      });
    },
    //批量添加
    submitLive(formName) {
      if (!this.fLive.id) {
        this.$modal.msgError("请选择一个收件地址！");
        return;
      }
      // this.fLive.sampleTalentInfoId = this.ids[0]
      let label = [];
      // this.fLive.colorProperty.forEach((item) => {
      this.colorProperty.forEach((item) => {
        //判断条件 货号不能为空
        if (label.indexOf(item.value) == -1 && item.value !== "") {
          label.push({
            productNo: item.value,
            sampleTalentInfoId: this.ids[0],
            sampleTalentCooperateId: null,
            sampleTalentCooperateType: "live",
            contactId: this.fLive.id,
            isReturn: this.fLive.isReturn,
            expressCompany: this.fLive.expressCompany,
            // ...this.fLive
          });
        }
      });
      if (label.length == 0) {
        this.$modal.msgError("请选择至少一个合作款式！");
        return;
      }
      this.fLive = label;
      // .filter((num, index) => { return num !== 'colorProperty' })
      // for (var item in this.fLive) {
      //   if (item == 'colorProperty') {
      //     delete this.fLive[item];
      //   }
      // }
      // console.log(JSON.stringify(this.fLive.sampleTalentTemplateList));
      console.log(JSON.stringify(this.fLive));
      // return
      this.$refs["fLive"].validate((valid) => {
        if (valid) {
          addApply(this.fLive).then((response) => {
            this.$refs["fLive"].resetFields();
            if (response.code == 200) {
              this.$modal.msgSuccess("新增成功");
              //
              // this.getList();
              // this.fAdd.colorProperty = []
              // this.$set(this.fLive, {});
              this.VisibleLive = false;
              this.colorProperty = this.$options.data().colorProperty;
              // Object.assign(, );
              this.$router.push({
                path: "/sample/sampleApply",
                query: { id: this.ids[0] },
              });
            } else {
              this.$modal.msgError("新增失败！");
              // Object.assign(this.$data, this.$options.data());
              this.VisibleLive = false;
              this.getList();
            }
          });
        }
      });
    },

    // 删除
    removeDomain(item) {
      var index = this.colorProperty.indexOf(item);
      if (index == "0") {
        // 还有一个的时候提示不能删除
        this.$message({
          message: "不能删除了",
          type: "error",
        });
        return false;
      }
      if (index !== -1 && index !== "0") {
        this.colorProperty.splice(index, 1);
      }
    },
    // 表单新增
    addDomain() {
      this.colorProperty.push({
        value: "",
        // key: Date.now()+,
      });
    },
    //批量添加
    chatAdd(row) {
      if (this.ids.length > 1 || this.ids.length == 0) {
        this.$modal.msgError("请选择一个指定达人信息！");
        return;
      }

      this.Visiblenote = true;
    },
    //批量添加
    submitNote() {
      this.fAdd.sampleTalentInfoId = this.ids[0];
      let label = [];
      this.colorProperty.forEach((item) => {
        //判断条件 货号不能为空
        if (label.indexOf(item.value) == -1 && item.value !== "") {
          label.push({ productNo: item.value });
        }
      });
      if (label.length == 0) {
        this.$modal.msgError("请选择至少一个合作款式！");
        return;
      }
      this.fAdd.sampleTalentTemplateList = label;
      console.log(JSON.stringify(this.fAdd.sampleTalentTemplateList));

      this.$refs["fAdd"].validate((valid) => {
        if (valid) {
          addNote(this.fAdd).then((response) => {
            if (response.code == 200) {
              this.$modal.msgSuccess("新增成功");
              // Object.assign(this.$data, this.$options.data());
              // this.getList();
              // this.fAdd.colorProperty = []
              this.Visiblenote = false;
              this.$router.push({ path: "/sample/note" });
            } else {
              this.$modal.msgError("新增失败！");
              Object.assign(this.$data, this.$options.data());
              this.Visiblenote = false;
              this.getList();
            }
          });
        }
      });
    },
    /**二级配置跳转**/
    go(row) {
      this.$router.push({ path: "/sample/contact", query: { id: row.id } });
    },
    contact(row) {
      listContact({ sampleTalentInfoId: row.id }).then((response) => {
        this.contactList = response.rows;
        this.contactopen = true;
      });
    },
    formatData(row) {
      console.log(JSON.stringify(row));
      // let rowPerson = (row) || [];
      // let arr = [];
      // rowPerson.forEach(item => {
      //   //如果数据特别多的话,还可以在这里加if判断,仅展示规定的数据
      //   arr.push(item.size);
      // });
      //
      return (
        row.receiverState +
        row.receiverCity +
        row.receiverDistrict +
        row.address
      );
    },
    goto(row) {
      this.$router.push({ path: "/sample/pay", query: { id: row.id } });
    },
    gotoApply(row) {
      this.$router.push({ path: "/sample/sampleApply", query: { id: row.id } });
    },
    pay(row) {
      listPay({ sampleTalentInfoId: row.id }).then((response) => {
        this.payList = response.rows;
        this.payopen = true;
      });
    },
    getApplyList(row) {
      listSampleApply({ sampleTalentInfoId: row.id }).then((response) => {
        this.sampleApplyList = response.rows;
        this.openApply = true;
      });
    },
    /** 查询达人信息列表 */
    getList() {
      this.loading = true;
      listSample(this.queryParams).then((response) => {
        this.sampleList = response.rows;
        console.log(JSON.stringify(this.sampleList));
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        platform: null,
        talentLevel: null,
        platformId: null,
        xhsNickname: null,
        contactPerson: null,
        recommendSituation: null,
        reason: null,
        personnelType: null,
        homeLink: null,
        fansNum: null,
        likeNum: null,
        cooperatePrice: null,
        contactWechat: null,
        talentStatus: null,
        isDelete: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.id);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加达人信息";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids;
      getSample(id).then((response) => {
        this.form = response.data;
        this.open = true;
        this.title = "修改达人信息";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          if (this.form.id != null) {
            updateSample(this.form).then((response) => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addSample(this.form).then((response) => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal
        .confirm('是否确认删除达人信息编号为"' + ids + '"的数据项？')
        .then(function () {
          return delSample(ids);
        })
        .then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download(
        "product/sample/export",
        {
          ...this.queryParams,
        },
        `sample_${new Date().getTime()}.xlsx`
      );
    },
    // table自动高度
    returnTableHeight(ref, bottomOffset) {
      let height = null;
      height =
        window.innerHeight - ref.getBoundingClientRect().top - bottomOffset;
      return height;
    },

    resizeTable() {
      this.$nextTick(() => {
        this.tableHeight = this.returnTableHeight(this.$refs.tableDom, 100);
      }, 0);
    },

    selectProvimce(id) {
      this.cityarr = [];
      this.regionarr = [];
      this.cityValue = "";
      this.RegionValue = "";
      for (let item of this.provincearr) {
        if (id == item.name) {
          console.log(item);
          this.cityarr = item.children;
        }
      }
    },
    selectcity(id) {
      this.regionarr = [];
      this.RegionValue = "";
      for (let item of this.cityarr) {
        if (id == item.name) {
          this.regionarr = item.children;
        }
      }
    },
  },
};
</script>
<style lang="scss" scoped>
.el-dialog-div {
  height: 60vh;
  overflow-x: hidden;
}

span.textname {
  display: -webkit-box;

  text-overflow: ellipsis;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  white-space: pre-wrap;
}

.el-textarea.is-disabled ::v-deep .el-textarea__inner {
  color: #606266;
  background-color: white;
  border: none;
  width: 500px;
  resize: none;
  cursor: pointer;
}
</style>
